package org.fhm.zdte.client.cmd;

import org.fhm.substrate.annotation.Component;
import org.fhm.substrate.annotation.Setup;
import org.fhm.zdte.common.ability.IGetIdentification;
import org.fhm.zdte.common.ability.IGetServerAddress;
import org.fhm.zdte.common.ability.IIsOffLineByIdentification;
import org.fhm.zdte.common.constant.protocol.PacketType;
import org.fhm.zdte.common.pojo.Address;
import org.fhm.zdte.common.protocol.AbstractMessageStandard;

/**
 * Online-Check command processor.
 *
 * @author 谭波
 * @since 2023/11/10
 */
@Component("ONLINE_CHECK")
public class OnlineCheckClientCmd extends AbstractClientCmd implements IIsOffLineByIdentification {

    @Setup
    private IGetIdentification iGetIdentification;

    @Setup
    private IGetServerAddress iGetServerAddress;

    @Override
    public void receiveCmd(Address address, AbstractMessageStandard message) {
        sendDealTask.getTaskAndSubmit(
                abstractMessageWrappers
                        .getAckMessageByPacketType(
                                PacketType.ONLINE_CHECK, null,
                                iGetIdentification.getIdentification(), "",
                                null, null,
                                ""),
                iGetServerAddress.getServerAddress()
        );
    }

    @Override
    public Boolean isOffLineByIdentification(String identification) {
        return null;
    }
}
